<template>
	<view class="Goods">
		<navBar title="好物推荐" isBack></navBar>
		<view class="P_View">
			<view class="P_List">
				<view class="P_flex">
					<view class="P_item" v-for="(items,indexs) in homeProductlist" :key="indexs"
						@click="navTo('/pages_mall/pages/mall/goods_details/goods_details?id=' +items.product_id)">
						<view class="P_image">
							<image lazyLoad="true" :src="items.main_imgurl"></image>
						</view>
						<view class="P_main">
							<view class="P_Title ellipsisText">{{items.product_title}}</view>
							<view class="P_Pirce">
								{{items.price}}
								<text class="P_money">元</text>
							</view>
						</view>
					</view>
					<!-- <view class="P_buttom" @click="GoSwitchTab('/pages/mall/index/index')">查看更多推荐</view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import URL from '@/config/url.js';
	import navBar from '@/components/navBar/navBar.vue';
	import service_design from '@/service/design'
	import service_mall from '@/service/mall.js'
	export default {
		data() {
			return {
				token: '',
				userMobile: '',
				homeProductlist:[],
			};
		},
		computed: {},
		watch: {},
		created() {},
		mounted() {},
		onLoad() {
			this.$utils.getUrl()
			var that = this
			that.tuishop()
		},
		onShow() {
			this.userMobile = this.$store.state.index.userMobile
			this.token = uni.getStorageSync('token')
		},
		methods: {
			// 推荐商品
			tuishop() {
				service_mall.index_gethomeProduct({}).then(res => {
					if (res.code == 1) {
						this.homeProductlist = res.data
					}
				});
			},
			navTo(url) {
				uni.navigateTo({
					url
				})
			},
		}
	};
</script>

<style lang="scss">
	page{
		background: #f2f2f2;
	}
	.ellipsisText {
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
	// 商品推荐
	.P_View {
		border-top: 1px solid #f6f7fb;
		padding-top: 32rpx;
		.P_List {
			padding: 0 32rpx;

			.P_flex {
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				justify-content: space-between;

				.P_item {
					background: #fff;
					margin-bottom: 24rpx;
					box-shadow: 0rpx 0rpx 16rpx rgba(0, 0, 0, 0.06);
					border-radius: 8rpx;
					overflow: hidden;
					height: 486rpx;
					width: 332rpx;

					.P_image {
						height: 334rpx;
						width: 332rpx;
					}

					.P_main {
						padding: 20rpx;

						.P_Title {
							font-size: 24rpx;
							font-weight: 400;
							line-height: 36rpx;
							color: #333333;
						}

						.P_Pirce {
							font-size: 28rpx;
							font-weight: 600;
							line-height: 44rpx;
							color: #333333;

							.P_money {
								font-size: 20rpx;
								font-weight: 400;
								line-height: 36rpx;
								color: #0D1019;
								margin-left: 4rpx;
							}
						}
					}
				}

				.P_buttom {
					width: 100%;
					height: 88rpx;
					background: #F8F8F8;
					border-radius: 4rpx;
					font-size: 28rpx;
					font-weight: 600;
					line-height: 88rpx;
					color: #333333;
					text-align: center;
					margin-bottom: 24rpx;
				}
			}
		}
	}
</style>
